package com.ghd.dataviz.utils;

import com.ghd.dataviz.core.security.impl.UserDetailsImpl;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @author ：ghd
 * @date ：Created in 2020-03-17 22:07
 * @description：
 * @modified By：
 * @version: $
 */
public class UserUtil {

    public static UserDetailsImpl getUserInfo() {
        return (UserDetailsImpl) SecurityContextHolder.getContext()
                .getAuthentication().getPrincipal();
    }

    public static String getUserName() {
        return getUserInfo().getUsername();
    }
}
